package com.cn.wanxi.service.impl;

import com.cn.wanxi.dto.CommonDto;
import com.cn.wanxi.model.CompanyModel;
import com.cn.wanxi.model.NavModel;
import com.cn.wanxi.model.ResultModel;
import com.cn.wanxi.service.ICommonService;
import com.cn.wanxi.service.ICompanyService;
import com.cn.wanxi.service.INavService;

import java.util.List;

public class CommonServiceImpl implements ICommonService {
    @Override
    public ResultModel getCommonData() {
        ResultModel resultModel = new ResultModel();
        CommonDto commonDto = new CommonDto();
        commonDto.setCompanyModel(getCompanyModel());
        commonDto.setNavModelList(getNavModelList());
        resultModel.setObject(commonDto);
        return resultModel;
    }

    private CompanyModel getCompanyModel() {
        ICompanyService iCompanyService = new CompanyServiceImpl();
        return iCompanyService.getCompanyModel();
    }

    private List<NavModel> getNavModelList() {
        INavService iNavService = new NavServiceImpl();
        return iNavService.getList();
    }

}
